import axios from '@/libs/request/axios'
import {getUri} from "@/libs/tools";
const basePath = "batchConfig"
export function listAllBatchInfo() {
    return axios.request({
        url: `/${getUri('batch')}/${basePath}/listAllBatchInfo`,
        method: 'get'
    });
}

export function editBatchInfo(data) {
    return axios.request({
        url: `/${getUri('batch')}/${basePath}/editBatchInfo`,
        method: 'post',
        data:data
    });
}
export function editBatchJobInfoApi(data) {
    return axios.request({
        url: `/${getUri('batch')}/${basePath}/editBatchJobInfo`,
        method: 'post',
        data:data
    });
}

export function removeBatchJobInfoApi(data) {
    return axios.request({
        url: `/${getUri('batch')}/${basePath}/removeBatchJobInfo`,
        method: 'post',
        data:data
    });
}
export function removeBatchInfo(systemName) {
    return axios.request({
        url: `/${getUri('batch')}/${basePath}/removeBatchInfo/${systemName}`,
        method: 'get'
    });
}

export function listJobGroup(systemName) {
    return axios.request({
        url: `/${getUri('batch')}/${basePath}/listJobGroup/${systemName}`,
        method: 'get'
    });
}

export function listJobGroupFilter(systemName,filterName='-') {
    return axios.request({
        url: `/${getUri('batch')}/${basePath}/listJobGroupFilter/${systemName}/${filterName}`,
        method: 'get'
    });
}
export function listStepList(systemName,batchNo,filterName='-') {
    return axios.request({
        url: `/${getUri('batch')}/${basePath}/listJobStepFilter/${systemName}/${batchNo}/${filterName}`,
        method: 'get'
    });
}
export function editBatchJobStepInfoApi(data) {
    return axios.request({
        url: `/${getUri('batch')}/${basePath}/editBatchJobStepInfo`,
        method: 'post',
        data:data
    });
}

export function removeBatchJobStepInfoApi(data) {
    return axios.request({
        url: `/${getUri('batch')}/${basePath}/removeBatchJobStepInfo`,
        method: 'post',
        data:data
    });
}


export function batchStart(systemName,batchNo) {
    return axios.request({
        url: `/${getUri('batch')}/batch/startBatch`,
        method: 'post',
        params: {
            systemName:systemName,
            batchNo:batchNo
        }
    });
}



export function resetError(systemName) {
    return axios.request({
        url: `/${getUri('batch')}/batch/resetError`,
        method: 'post',
        params: {
            systemName:systemName
        }
    });
}


export function queryStepLogs(data) {
    return axios.request({
        url: `/${getUri('batch')}/${basePath}/queryStepLogs`,
        method: 'post',
        data: data
    });
}
